/**
 * 
 */
package de.dhbw.horb.inf2013.vierFarbenProblem.model.datatypes;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

/**
 * The Class Vertex.
 */
public class Vertex {

	/** The id. */
	private int id;

	/** The neighbors. */
	private Set<Integer> neighbors = new HashSet<Integer>();

	/**
	 * Instantiates a new vertex.
	 * 
	 * @param id
	 *            the id
	 */
	public Vertex(int id) {
		this.id = id;
	}

	/**
	 * Gets the id.
	 * 
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * Adds the neighbor.
	 * 
	 * @param neighbor
	 *            the neighbor
	 */
	public void addNeighbor(int neighbor) {
		neighbors.add(neighbor);
	}

	/**
	 * Gets the neighbors.
	 * 
	 * @return the neighbors
	 */
	public Integer[] getNeighbors() {
		return (Integer[]) neighbors.toArray(new Integer[neighbors.size()]);
	}

	/**
	 * Checks if is neighbor.
	 * 
	 * @param id
	 *            the id
	 * @return true, if is neighbor
	 */
	public boolean isNeighbor(int id) {
		return neighbors.contains(id);
	}
}
